// Promise.race()   返回最先得到的结果，不管是成功还是失败

function myPromiseRace(promises) {
    if (Array.isArray(promises)) {
        console.error('Args must be an array');
    };

    return new Promise((resolve, reject) => {
        for (let item of promises) {
            Promise.resolve(item)
            .then(value => {
                resolve(value);
            }).catch(err => reject(err));
        }
    })
};